// 将各个模块的路由合并处理
const path = require("path");
const fs = require("fs");
module.exports = function (app) {
  // 读取当前文件夹下面除了index.js的文件
  const files = fs.readdirSync(path.resolve(__dirname, "../routes"));
  files.map((file) => {
    if (file !== "index.js") {
      const router = require(path.resolve(__dirname, `../routes/${file}`));
      app.use(router.routes());
      app.use(router.allowedMethods());
    }
  });
};
